package com.bw.mapper;

import com.bw.bean.Vo;
import com.bw.bean.Vo1;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;


public interface VoMapper {


    @Select("select bt.name,\n" +
            "       if(ui.gender='F','女','男') gender,\n" +
            "       sum(oi.final_total_amount) `value`\n" +
            "from order_info oi\n" +
            "left join order_detail od on oi.id = od.order_id\n" +
            "left join sku_info si on od.sku_id = si.id\n" +
            "left join base_trademark bt on si.tm_id = bt.id\n" +
            "left join  user_info ui on oi.user_id = ui.id\n" +
            "group by bt.name,ui.gender")
    List<Vo1> getList4();


    @Select("select  yys name,sum(final_total_amount) `value` from  order_info   group by yys having yys is not null")
    List<Vo> getList3();


    @Select("select concat(substring(ui.birthday,3,1),'0后') `name`, sum(oi.final_total_amount) `value`\n" +
            "from order_info oi\n" +
            "left join user_info ui on oi.user_id = ui.id\n" +
            "group by concat(substring(ui.birthday,3,1),'0后')")
    List<Vo> getList2();


    @Select("select   c.name,sum(oi.final_total_amount) `value`  from order_info oi\n" +
            "left join order_detail od on oi.id = od.order_id\n" +
            "left join sku_info si on od.sku_id = si.id\n" +
            "left join  base_category3 b on si.category3_id = b.id\n" +
            "left join  base_category2 c on b.category2_id = c.id\n" +
            "group by c.name order by `value`")
    List<Vo> getList1();
}
